/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package camel.client;

import camel.server.admin.TeamMember;
import java.io.Serializable;

/**
 *
 * @author mac
 */
public class SessionTicket implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private boolean isLogInSuccessful = false;
    private String username;
    private TeamMember.MemberRole role = TeamMember.MemberRole.disabled;
    //private String signature;
    private Long cursorId;
    private Long sessionId;
    private boolean inSession = false;
    private boolean roleChanged = false;
    
    private Long sn;
    private String token;
    
    private boolean lastOpSuccessful;

	public SessionTicket() {
    }
        
    public void setUsername (String name) {
        this.username = name;
    }
    public String getUsername () {
        return this.username;
    }
     public TeamMember.MemberRole getRole() {
        return role;
    }

    public void setRole(TeamMember.MemberRole role) {
        this.role = role;
    }

    /*
    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }
    
    public void signTicket (String key) {
        signature = "SERVER_SIGN_"+ key + this.role.toString() + cursorId;
        if ( this.username != null) {
            signature += this.username;
        }
    }
    
    public boolean IsTicketValid (String key) {
        //@TODO
        String temp = "SERVER_SIGN_"+ key + this.role.toString() + cursorId;
        if ( this.username != null) {
            temp += this.username;
        }
        
        if ( temp.equals(signature)) {
            return true;
        }
        return false;
    }
    */

    public boolean isLogInSuccessful() {
        return isLogInSuccessful;
    }

    public void setLogInSuccessful(boolean isLogInSuccessful) {
        this.isLogInSuccessful = isLogInSuccessful;
    }

    public Long getCursorId() {
        return cursorId;
    }

    public void setCursorId(Long cursorId) {
        this.cursorId = cursorId;
    }

    public boolean isLastOpSuccessful() {
        return lastOpSuccessful;
    }

    public void setLastOpSuccessful(boolean lastOpSuccessful) {
        this.lastOpSuccessful = lastOpSuccessful;
    }

    public Long getSessionId() {
        return sessionId;
    }

    public void setSessionId(Long sessionId) {
        this.sessionId = sessionId;
    }

	public boolean isInSession() {
		return inSession;
	}
	public void setRoleChange(boolean roleChanged) {
		this.roleChanged = roleChanged;
	}
	public boolean isRoleChanged() {
		return roleChanged;
	}
	public void setInSession(boolean inSession) {
		this.inSession = inSession;
	}

	public Long getSn() {
		return sn;
	}

	public void setSn(Long sn) {
		this.sn = sn;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

}
